home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / misc / pdflib / bindings / tcl / hello.tcl next >
Text File  |  1999-01-01  |  677b  |  33 lines

  1. #!/usr/local/bin/tclsh
  2.  
  3. # simple loading the shared-library:
  4. load ./pdflib.so
  5.  
  6. # using pdflib as package:
  7. # lappend is unnecessary if installed at some right place
  8.  
  9. lappend auto_path .
  10. package require pdflib
  11.  
  12. # doesn't yet work
  13. #namespace import pdflib::*
  14.  
  15. set fp [fopen hello_tcl.pdf w]
  16.  
  17. set ip [PDF_get_info]
  18.  
  19. PDF_info_Creator_set $ip "hello.tcl"
  20. PDF_info_Author_set $ip "RJS"
  21. PDF_info_Title_set $ip "Hello world (Tcl)"
  22. PDF_info_fontpath_set $ip "../../fonts"
  23.  
  24. set p [PDF_open $fp $ip]
  25.  
  26. PDF_begin_page $p 595 842
  27. PDF_set_font $p Helvetica-Bold 18.0 $winansi
  28. PDF_set_text_pos $p 50 700
  29. PDF_show $p "Hello world!"
  30. PDF_continue_text $p "(says Tcl)"
  31. PDF_end_page $p
  32. PDF_close $p
  33.